import java.util.Timer;
import java.util.TimerTask;

/**
 * @author wang'ji'cheng
 * @date 2025/7/28
 */
public class TimerExample {
    public static void main(String[] args) {

        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {@Override
            public void run() {
                System.out.println("执行任务"+System.currentTimeMillis());
            }
        },1000,2000);
    }
}

